1. /* sdmmlp10.cpp by K.Tsuru */
  2. // function ID = 341 DRADIX
  3. /*******************************************
  4. SDouble class
  5. a member function
  6. It multiplies by the 10 to the p-th power.
  7. *this *= 10^p
  8. *******************************************/
  9. #ifndef SN_H
  10. #include "sn.h"
  11. #endif
  12. static const char* const func = "MultPow10";
  13. SDouble& SDouble::MultPow10(long p){
  14. if(Type() != REAL) SetError(RADIX_ERR, func, 341);
  15. if(!p || (Sign(341) == 0) ) return *this;
  16. long n = p/DFIGURES, r = p - DFIGURES*n;// p < 0 is ok
  17. if(r < 0){
  18. r += DFIGURES; n--;
  19. }
  20. if(labs(n) > DRADIX_EXP_MAX) SetError(TOO_LARGE_EXP, func, 341);
  21. if(n) MultPowRdx((int)n); // includes Reform();
  22. //Maybe in the fixed point mode and n<0 it becomes zero.
  23. if(r && Sign(341)){
  24. ulong c = (ulong)ipow10((int)r);
  25. *this = DsMult(*this, c); // includes Reform();
  26. }
  27. return *this;
  28. }

sdmmlp10.cpp : last modifiled at 2015/11/25 20:15:20(877 bytes)
created at 2017/10/07 10:21:15
The creation time of this html file is 2017/10/07 10:30:03 (Sat Oct 07 10:30:03 2017).